<%--
  Created by IntelliJ IDEA.
  User: 97203
  Date: 2018/06/08
  Time: 12:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <%@include file="/static/common/common.jsp" %>
    <link rel="stylesheet" href="/static/css/reset.css">
    <link rel="stylesheet" href="/static/css/public.css">
    <script>
        $(function () {
            $("#myTree").tree({
                url: '/menu/selectEmployeeMenu.do',
                state: closed,
                animate: true,
                onClick: function (node) {
                    if (node.url) {
                        //判断节点是否已存在
                        var exists = $("#myTabs").tabs('exists', node.text);
                        if (exists) {
                            $("#myTabs").tabs('select', node.text);
                        } else {
                            //创建选项卡面板
                            $("#myTabs").tabs('add', {
                                title: node.text,
                                //href: node.url,
                                content: '<iframe src="' + node.url + '" height="100%" width="100%" frameborder="0"></iframe>',
                                closable: true
                            })
                        }
                    }
                }
            })
        })

        $("#welcode_datagrid").datagrid({
            fit: true,
        })
        function saveUp() {
            $.messager.confirm('确认对话框', '您想要执行签到？', function (r) {
                if (r) {
                    $.get('/attendance/saveUp.do', function (data) {
                        if (data.success) {
                            $.messager.alert('温馨提示', '签到成功！', 'info', function () {
                                $("#welcode_datagrid").datagrid('reload');
                            });
                        } else {
                            $.messager.alert('温馨提示', data.msg, 'warning');
                        }
                    })
                }

            });
        }
        function saveNext() {
            $.messager.confirm('确认对话框', '您想要执行签退？', function (r) {
                if (r) {
                    $.get('/attendance/saveNext.do', function (data) {
                        if (data.success) {
                            $.messager.alert('温馨提示', '签到成功！', 'info', function () {
                                $("#welcode_datagrid").datagrid('reload');
                            });
                        } else {
                            $.messager.alert('温馨提示', data.msg, 'warning');
                        }
                    })
                }
            });
        }
    </script>
</head>
<body>
<div class="easyui-layout" fit="true">
    <div data-options="region:'north'" style="height: 70px;">
        <div class="public-header-warrp">
            <div class="public-header">
                <div class="content">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="static/images/头.png" style="width: 340px;height: 102px"/>
                    <div class="public-header-admin fr">
                        <img src="/static/plugins/jquery-easyui/themes/icons/man.png">
                        <shiro:principal property="realname"></shiro:principal>
                        <p class="admin-name"><font color="#0081c2">您好！</font>
                        </p>
                        <div class="public-header-fun fr">
                            <a href="/logout.do" class="public-header-loginout">安全退出</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div data-options="region:'south'" style="height: 40px;">
        <p align="center">版权声明</p>
    </div>
    <div data-options="region:'west'" style="width: 250px;">
        <div class="easyui-accordion theme-panel-simple" fit="true">
            <div title="搜索栏" data-options="iconCls:'icon-search',collapsed:false,collapsible:false"
                 style="padding:10px;">
                <input id="search" class="easyui-searchbox" style="width:200px;height:25px;">
            </div>
            <div id="myTree" title="菜单列表" data-options="selected:true,iconCls:'icon-folder_search',collapsed:true"
                 class="theme-panel-simple">
                <%--<ul id="myTree"></ul>--%>
            </div>
            <div title="待办事项" data-options="iconCls:'icon-help',collapsed:true">
                <h3 style="color:#0099FF;">Accordion for jQuery</h3>
                <p>Accordion is a part of easyui framework for jQuery. It lets you define your accordion component on
                    web page more easily.</p>
            </div>
            <div title="公司公告" data-options="iconCls:'icon-information',collapsed:true">公司公告</div>
        </div>
    </div>
    <script>
        $(function () {
            $('#search').searchbox({
                prompt: '没有用，不要搜',
                searcher: function (value, name) {
                    if (value) {
                        alert(value + "是什么," + "都说搜索功能没做咯！");
                    } else {
                        alert("请输入搜索内容！");
                    }
                }

            });
        })
    </script>
    <div data-options="region:'center'">
        <div id="myTabs" class="easyui-tabs theme-tab-blue-line" fit="true" data-options="tabPosition:'top'">
            <div title="欢迎界面" data-options="iconCls:'icon-tip',closable:true">
                <table id="welcode_datagrid" style="border: none"></table>
                <font size="32px">签到:如果签到时间超过8.30,签到时间的单元格背景变红,属于迟到.</font><br/>
                <font size="32px">签退:如果签退时间早于17.30,签退时间的单元格背景变红,属于早退</font><br/>
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true"
                   onclick="saveUp()">打卡</a> <br>
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" onclick="saveNext()">王者早退</a>
            </div>
        </div>
    </div>
</div>
</body>
</html>